import numpy as np
import matplotlib.pyplot as plt

# 柱形图
x = np.array(['Jan', 'Feb', 'Mar', 'Apr'])
height = np.array([10, 15, 12, 8])
color = ["#4CAF50","red","hotpink","#556B2F"]  # 随机颜色
# 绘制柱形图
plt.bar(x, height, color=color, width=0.5) # 纵向柱形图
# plt.barh(x, height, align='center') # 横向柱形图
plt.show()

